package com.bawei.hgshop.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;

import com.bawei.hgshop.entity.Cart;

public interface CartMapper {

	/**
	 * 加入购物车
	 * @param cart
	 */
	@Insert("insert into hg_cart(uid,pnum,skuid,createtime,updatetime)"
			+ "values(#{uid},#{pnum},#{sku.id},now(),now())")
	void add(Cart cart);

	List<Cart> listCart(int uid);

	List<Cart>  listCartByIds(@Param("uid") int uid,@Param("ids")  int[] cartIds);

	//从购物车中删除
	@Delete("delete from hg_cart where id=#{value}")
	void delById(int id);

}
